package zyd.springboot.springbootmybatis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zyd.springboot.springbootmybatis.entity.User;
import zyd.springboot.springbootmybatis.service.UserService;

@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/regist")
    public String regist() {
        User user=new User();
        user.setUsername("孙猴子2");
        user.setPassword("123456");
        user.setAge(12);
        userService.register(user);
      return "注册成功";

    }
    @RequestMapping("/login")
    public String login(){
        User user=new User();
        user.setUsername("孙猴子2");
        user.setPassword("12345");
        user.setAge(12);
        User result=userService.login(user);
        return "登陆成功";
    }
}
